<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <script>
        function updateUI() {
            console.time("Test")
            let doms = document.querySelectorAll("div")
            for (let i = 0; i < doms.length; i++) {
                doms[i].innerText = document.title + i
            }
            console.timeEnd("Test")
        }
        function betterUpdateUI() {
            console.time("betterTest")
            const doc = document
            let doms = doc.querySelectorAll("div")
            for (let i = 0; i < doms.length; i++) {
                doms[i].innerText = doc.title + i
            }
            console.timeEnd("betterTest")
        }
        updateUI()
        betterUpdateUI()
    </script>
</body>

</html>